package la.iok.hzsvn.lewin.movie.cloud.model;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

public class TokenInfo {
    @JsonProperty("access_token")
    private String accessToken;
    @JsonProperty("token_type")
    private String tokenType;
    @JsonProperty("expires_in")
    private int expiresIn;
    @JsonProperty("refresh_token")
    private String refreshToken;
    private Long userId;
    private Long orgUnitId;
    private Long deviceId;
    private Long roomId;
    private String code;
    private String openID;
    /**
     * 会话id.微信小程序登录的时候,如果用户未绑定，需要先获取用户身份（openId,unionId),之后返回前端再次获取用户手机号进行绑定/注册。
     * 此时需要保存sessionID的用户身份，并将sessionID传到前端，前端在请求手机号授权之后将授权码与sessionID一起传到后台，
     * 此时根据sessionID查询用户身份之后再进行绑定/注册操作
     */
    private String sessionID;

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getTokenType() {
        return tokenType;
    }

    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }

    public int getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(int expiresIn) {
        this.expiresIn = expiresIn;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getOrgUnitId() {
        return orgUnitId;
    }

    public void setOrgUnitId(Long orgUnitId) {
        this.orgUnitId = orgUnitId;
    }

    public Long getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(Long deviceId) {
        this.deviceId = deviceId;
    }

    public Long getRoomId() {
        return roomId;
    }

    public void setRoomId(Long roomId) {
        this.roomId = roomId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getOpenID() {
        return openID;
    }

    public void setOpenID(String openID) {
        this.openID = openID;
    }

    public String getSessionID() {
        return sessionID;
    }

    public void setSessionID(String sessionID) {
        this.sessionID = sessionID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TokenInfo tokenInfo = (TokenInfo) o;
        return expiresIn == tokenInfo.expiresIn && Objects.equals(accessToken, tokenInfo.accessToken) && Objects.equals(tokenType, tokenInfo.tokenType) && Objects.equals(refreshToken, tokenInfo.refreshToken) && Objects.equals(userId, tokenInfo.userId) && Objects.equals(orgUnitId, tokenInfo.orgUnitId) && Objects.equals(deviceId, tokenInfo.deviceId) && Objects.equals(roomId, tokenInfo.roomId) && Objects.equals(code, tokenInfo.code) && Objects.equals(openID, tokenInfo.openID);
    }

    @Override
    public int hashCode() {
        return Objects.hash(accessToken, tokenType, expiresIn, refreshToken, userId, orgUnitId, deviceId, roomId, code, openID);
    }
}
